#include "CoYCursor.h"


using namespace cinder;

CoYCursor::CoYCursor(string objectID, float x, float y,cinder::gl::TextureFontRef textureFont) :
    objectID(objectID),
    x(x),
    y(y),
    mTextureFont(textureFont)

{
    drawString = objectID;
    drawString.erase(drawString.end()-6,drawString.end());
}

void CoYCursor::draw()
{
    glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
    glEnable(GL_BLEND);
    //glDisable(GL_DEPTH_TEST);
    float size = 2;
    glLineWidth(3.0);
    glBegin(GL_TRIANGLES);
        glColor4f(0.0,0.0,0.0,0.35);
        glVertex3f(x,y,0);
        glVertex3f(x-(3*size),y-(12*size),0);
        glVertex3f(x+(6*size),y-(6*size),0);
    glEnd();
    glBegin(GL_LINE_STRIP);
        glColor4f(1.0,1.0,1.0,1.0);
        glVertex3f(x,y,0);
        glVertex3f(x-(3*size),y-(12*size),0);
        glVertex3f(x+(6*size),y-(6*size),0);
        glVertex3f(x,y,0);
    glEnd();
    gl::color( ColorA( 1,1,1,1.0 ) );
    gl::drawSolidCircle(Vec2f(x,y),2);
    gl::drawSolidCircle(Vec2f(x-(3*size),y-(12*size)),2);
    gl::drawSolidCircle(Vec2f(x+(6*size),y-(6*size)),2);

    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ONE_MINUS_SRC_COLOR);
    mTextureFont->drawString(drawString,Rectf(x,y,x+200,y+40));
}

void CoYCursor::setX(float x)
{
    this->x = x;
}

void CoYCursor::setY(float y)
{
    this->y = y;
}
